package com.edu.service.impl;

import com.edu.entity.User;
import com.edu.mapper.UserMapper;
import com.edu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ProjectName: springboot-project47
 * @Titile: UserServiceImpl
 * @Author: Administrator
 * @Description: 用户业务实现类
 */
@Service //业务层注解
@Transactional //事务注解
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;//注入数据访问对象

    @Override
    public List<User> findAll() {
        // todo 业务处理
        List<User> users = userMapper.getAll();
        //todo 业务判断
        //如果数据不为空，直接返回
        //如果为空，需要业务处理
        return users;
    }
}
